import 'dart:ui';

import 'package:flutter_app/config/decoders.dart';
import 'package:flutter_app/resources/widgets/friend_widget.dart';
import 'package:flutter_app/resources/widgets/paper_widget.dart';
import 'package:flutter_app/resources/widgets/women_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:nylo_framework/theme/helper/ny_theme.dart';
import 'package:flutter/material.dart';
import '../../config/constant.dart';
import '/bootstrap/extensions.dart';
import '/resources/widgets/logo_widget.dart';
import '/resources/widgets/safearea_widget.dart';
import '/bootstrap/helpers.dart';
import '/app/controllers/home_controller.dart';

class HomePage extends NyPage<HomeController> {
  static String path = '/home';

  @override
  init() async {}

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, designSize: ScreenSize);

    /// 低部导航栏
    Widget bottomNavigateBar = Container(
      color: ThemeColor.get(context).primaryBackgroundDeep.withOpacity(1),
      child: BottomNavigationBar(
        elevation: 0,
        currentIndex: controller!.bottomCurrentIndex,
        onTap: (index) => controller!.onBottomChange(index, refreshPage),
        // selectedFontSize: 26.sp,
        // unselectedFontSize: 28.sp,
        selectedLabelStyle: TextStyle(fontWeight: FontWeight.bold),
        unselectedLabelStyle: TextStyle(fontWeight: FontWeight.bold),
        selectedItemColor: ThemeColor.get(context).background,
        backgroundColor: Colors.transparent,
        items: <BottomNavigationBarItem>[
          BottomNavigationBarItem(
              label: '我的纸条',
              icon: SvgPicture.asset("public/assets/images/index.svg",
                  width: 50.w, height: 50.h),
              activeIcon: SvgPicture.asset("public/assets/images/s_index.svg",
                  width: 40.w, height: 40.h)),
          BottomNavigationBarItem(
              label: '抽个对象',
              icon: SvgPicture.asset("public/assets/images/add.svg",
                  width: 50.w, height: 50.h),
              activeIcon: SvgPicture.asset("public/assets/images/s_add.svg",
                  width: 40.w, height: 40.h)),
          BottomNavigationBarItem(
              label: '开通红娘',
              icon: SvgPicture.asset("public/assets/images/red_woman.svg",
                  width: 50.w, height: 50.h),
              activeIcon: SvgPicture.asset(
                  "public/assets/images/s_red_woman.svg",
                  width: 40.w,
                  height: 40.h)),
        ],
      ),
    );

    return Scaffold(
      body: Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
            colors: [
              ThemeColor.get(context).primaryBackgroundLight,
              ThemeColor.get(context).primaryBackgroundDeep.withOpacity(1),
            ],
          ),
        ),
        child: SafeAreaWidget(
            child: PageView(
              controller: controller!.pageController,
              physics: NeverScrollableScrollPhysics(),
          children: [Paper(), Friend(), Women()],
        ) // 毛玻璃效果

            ),
      ),
      bottomNavigationBar: bottomNavigateBar,
    );
  }
}
